package com.ruoyi.system.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.SysExamine;
import com.ruoyi.system.domain.SysFlyingBook;
import com.ruoyi.system.mapper.SysExamineMapper;
import com.ruoyi.system.mapper.SysFlyingBookMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @Author Yin
 * @Date 2024/12/1 10:54
 * @Version 1.0
 */
@RestController
@RequestMapping("/system/public")
public class PublicController {

    @Resource
    private SysExamineMapper sysExamineMapper;

    @Resource
    private SysFlyingBookMapper sysFlyingBookMapper;

    /**
     * 获取首页数据
     * @param request
     * @return
     */
    @GetMapping(value = "/getsubstation")
    public AjaxResult getSubstation(HttpServletRequest request){
        //封装请求
        Map<String,Object> map = new HashMap<>();
        //获取网站配置数据
        SysExamine sysExamine = sysExamineMapper.selectOne(new LambdaQueryWrapper<SysExamine>().eq(SysExamine::getDeleted, 0));
        SysFlyingBook sysFlyingBook = sysFlyingBookMapper.selectOne(new LambdaQueryWrapper<SysFlyingBook>().eq(SysFlyingBook::getDeleted, 0));
        map.put("status",false);
        map.put("sysExamine",sysExamine);
        map.put("sysFlyingBook",sysFlyingBook);
        return AjaxResult.success(map);
    }
}
